package org.example.controller;

import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
//import graphql.ExecutionInput;
//import graphql.GraphQL;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

//@RestController
@RequiredArgsConstructor
public class GraphQLController {
//    private final GraphQL graphQL;
//
//    @RequestMapping("/graphql")
//    public Map<String, Object> graphql(@RequestBody String request) {
//        JSONObject req = JSONUtil.parseObj(request);
//        ExecutionInput executionInput = ExecutionInput.newExecutionInput()
//                .query(req.getStr("query"))
//                .operationName(req.getStr("operationName"))
//                .variables(req.getJSONObject("variables"))
//                .build();
//        // 执行
//        return graphQL.execute(executionInput).toSpecification();
//    }
}
